import React from 'react';
import { Button } from 'antd';
import CommonList from '../../../../components/CommonLists/list';

class CustomParamsList extends CommonList {
  constructor(props) {
    super(props);
    this.api = 'customParams';
    this.btnGroup = [
      (record) => (
        <Button type='link' onClick={() => this.edit(record, {})} disabled={record.audit_status === this.AUDIT._WAIT}>
          编辑
        </Button>
      ),
      (record) => (
        <Button type='link' onClick={() => this.delete(record)} disabled={record.audit_status === this.AUDIT._WAIT}>
          删除
        </Button>
      ),
      (record) => (
        <Button
          type='link'
          onClick={() => this.handleVersion(record)}
          disabled={record.audit_status === this.AUDIT._WAIT}
        >
          版本
        </Button>
      ),
    ];
  }

  getDeleteParam = ({ third_list_param_id }) => ({ third_list_param_id });

  handleVersion = ({ third_list_param_id }) => {
    this.props.history.push(`/variable/map/customParams/${third_list_param_id}/version`);
  };
}

export default CustomParamsList;
